﻿using System;

namespace rehot
{
    public class HotAttribute : HotObject, IDisposable
    {
        internal object attr { get; set; }
        public string Name { get; }
        internal HotAttribute(object obj_attr) : base(obj_attr)
        {
            attr = obj_attr;
            Name = GetStdName(_hottype.Name);
        }
        internal HotAttribute(HotType hotType, object obj_attr) : base(hotType, obj_attr)
        {
            attr = obj_attr;
            Name = GetStdName(_hottype.Name);
        }
        internal static string GetStdName(string name)
        {
            name = name.ToLower();
            if (name.Length > 9 && name.Substring(name.Length - 9, 9) == "attribute") return name.Substring(0, name.Length - 9);
            return name;
        }
        public override void Dispose()
        {
            base.Dispose();
            attr = null;
        }
    }
}
